package com.itheima.controller;

import com.itheima.common.R;
import com.itheima.service.DishService;
import com.itheima.vo.DishVO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**菜品管理接口
 * @author msi
 */
@RestController
@RequestMapping("/dish")
public class DishControllerM {

    @Resource
    private DishService service;

    @GetMapping("/list")
    public R<List<DishVO>> getList(@RequestParam("categoryId") String categoryId, @RequestParam("status") Integer status){

        List<DishVO> list = service.getList(categoryId, status);

        return R.success(list);
    }

    @GetMapping("/{id}")
    public R<DishVO> getById(@PathVariable String id){

        DishVO dishVO = service.selectById(id);

        return R.success(dishVO);
    }

}
